<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:cc="http://java.sun.com/jsf/composite">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="bill" class="com.divudi.entity.Bill" type="com.divudi.entity.Bill" />
        <cc:attribute name="dup" />
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>



        <h:panelGroup>
            <h:outputStylesheet library="css" name="printing.css" ></h:outputStylesheet>

            <div class="fiveinchbillBreakRuhunu" >

                <h:panelGroup id="panelAddedBillPrint">

                    <div style="position: absolute!important;
                         left: 60%!important; 
                         font-weight: bold!important;
                         top: 0%!important;
                         text-decoration: underline!important;">
                        <h:outputLabel value="Channel Invoice" style="font-size: 13px!important;"/>
                    </div>
                    <div style="position: absolute!important;
                         left: 50%!important;
                         top: 4%!important;">
                        <h:outputLabel value="VAT Reg. No : 114103438-7000" style="font-size: 8px!important;"/>
                    </div>
                    <div style="position: absolute!important;
                         left: 40%!important;
                         top: 8%!important;
                         font-size: 8px!important;">
                        <h:outputLabel value="**Duplicate**"  rendered="#{cc.attrs.dup eq true}" /> 
                        <h:outputLabel value="**Cancelled**"  rendered="#{cc.attrs.bill.cancelled eq true}" /> 
                    </div>
                    <div>
                        <div style="position: absolute!important; top: 12%!important;">
                            <table width="350" >
                                <tr>
                                    <td width="25%">
                                        <b>
                                            <h:outputLabel value="Number" ></h:outputLabel>
                                        </b>
                                    </td>
                                    <td>
                                        <p:spacer width="10" ></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <b>
                                            <p:outputLabel value="#{cc.attrs.bill.singleBillSession.serialNo}" style="font-size:30px !important;  font-weight: bold; margin: 5px;padding: 5px;color: red;" />
<!--                                            <ui:repeat value="#{cc.attrs.bill.billItems}" var="cbi" >
                                                <h:outputLabel value="#{cbi.billSession.serialNo}" style="font-size:30px !important;  font-weight: bold; margin: 5px;padding: 5px;border: 1px solid black; color: red;" ></h:outputLabel>
                                            </ui:repeat>-->
                                        </b>
                                    </td>

                                </tr>


                                <tr>
                                    <td>
                                        <h:outputLabel value="Name" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <p:spacer width="10" ></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" ></h:outputLabel>
                                    </td>
                                    <td align="justify" >
                                        <h:outputLabel value="#{cc.attrs.bill.patient.person.nameWithTitle}" ></h:outputLabel>
                                    </td>

                                </tr>

                                <tr>
                                    <td>
                                        <h:outputLabel value="Ref. Number" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <p:spacer width="10" ></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" ></h:outputLabel>
                                    </td>
                                    <td align="justify" >
                                        <h:outputLabel value="#{cc.attrs.bill.insId}" rendered="#{cc.attrs.bill.paidBill eq null}"></h:outputLabel>
                                        <h:outputLabel value="#{cc.attrs.bill.paidBill.insId}" rendered="#{cc.attrs.bill.paidBill ne null}"></h:outputLabel>
                                    </td>

                                </tr>

                                <tr>
                                    <td>
                                        <h:outputLabel value="Phone" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <p:spacer width="10" ></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <h:outputLabel value="#{cc.attrs.bill.patient.person.phone}" ></h:outputLabel>
                                    </td>
                                </tr>



                                <tr>
                                    <td>
                                        <b>
                                            <h:outputLabel value="Consultant" ></h:outputLabel>
                                        </b>
                                    </td>
                                    <td>
                                        <p:spacer width="10" ></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" ></h:outputLabel>
                                    </td>
                                    <td align="justify">
                                        <b>
                                            <h:outputLabel value="#{cc.attrs.bill.staff.person.nameWithTitle}" ></h:outputLabel>
<!--                                            <ui:repeat value="#{cc.attrs.bill.billItems}" var="cbi" >
                                                <h:outputLabel value="#{cbi.billSession.staff.person.nameWithTitle}" ></h:outputLabel>
                                            </ui:repeat>-->
                                        </b>
                                    </td>

                                </tr>

                                <tr>
                                    <td>
                                        <b>
                                            <h:outputLabel value="App. Date" ></h:outputLabel>
                                        </b>
                                    </td>
                                    <td>
                                        <p:spacer width="10" ></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <b>
                                            <h:outputLabel value="#{cc.attrs.bill.singleBillSession.sessionDate}" >
                                                <f:convertDateTime pattern="dd MMMM yyyy" ></f:convertDateTime>
                                            </h:outputLabel>
                                        </b>
                                    </td>

                                </tr>

                                <tr>
                                    <td>
                                        <b>
                                            <h:outputLabel value="App. Time" ></h:outputLabel>
                                        </b>
                                    </td>
                                    <td>
                                        <p:spacer width="10" ></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <b>
                                            <h:outputLabel value="#{cc.attrs.bill.singleBillSession.serviceSession.startingTime}" >
                                                <f:convertDateTime pattern="hh:mm a" ></f:convertDateTime>
                                            </h:outputLabel>
                                        </b>
                                    </td>

                                </tr>

                                <tr>
                                    <td>
                                        <b>
                                            <h:outputLabel value="Room No." rendered="#{cc.attrs.bill.singleBillSession.serviceSession.roomNo ne 0}"></h:outputLabel>
                                        </b>
                                    </td>
                                    <td>
                                        <p:spacer width="10" rendered="#{cc.attrs.bill.singleBillSession.serviceSession.roomNo ne 0}"></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" rendered="#{cc.attrs.bill.singleBillSession.serviceSession.roomNo ne 0}"></h:outputLabel>
                                    </td>
                                    <td>

                                        <h:outputLabel value="#{cc.attrs.bill.singleBillSession.serviceSession.roomNo}" style="font-weight: bold;" rendered="#{cc.attrs.bill.singleBillSession.serviceSession.roomNo ne 0}">
                                        </h:outputLabel>

                                    </td>

                                </tr>

                                <tr>
                                    <td>
                                        <h:outputLabel value="Hospital Fee" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <p:spacer width="10" ></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <h:outputLabel value="#{cc.attrs.bill.netTotal-cc.attrs.bill.staffFee}" >
                                            <f:convertNumber pattern="#,##0.00" ></f:convertNumber>
                                        </h:outputLabel>
<!--                                        <h:outputLabel value="#{cc.attrs.bill.vatPlusHosFee}" >
                                            <f:convertNumber pattern="#,##0.00" ></f:convertNumber>
                                        </h:outputLabel>-->
                                    </td>

                                </tr>

                                <tr>
                                    <td>
                                        <h:outputLabel value="Doctor Fee" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <p:spacer width="10" ></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <h:outputLabel value="#{cc.attrs.bill.staffFee}" >
                                            <f:convertNumber pattern="#,##0.00" ></f:convertNumber>
                                        </h:outputLabel>
<!--                                        <h:outputLabel value="#{cc.attrs.bill.vatPlusStaffFee}" >
                                            <f:convertNumber pattern="#,##0.00" ></f:convertNumber>
                                        </h:outputLabel>-->
                                    </td>

                                </tr>

                                <tr>
                                    <td>
                                        <h:outputLabel value="Government Taxes" rendered="#{cc.attrs.bill.vat ne 0.0}"></h:outputLabel>
                                    </td>
                                    <td>
                                        <p:spacer width="10" rendered="#{cc.attrs.bill.vat ne 0.0}"></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" rendered="#{cc.attrs.bill.vat ne 0.0}"></h:outputLabel>
                                    </td>
                                    <td>
                                        <h:outputLabel value="#{cc.attrs.bill.vat}" rendered="#{cc.attrs.bill.vat ne 0.0}">
                                            <f:convertNumber pattern="#,##0.00" ></f:convertNumber>
                                        </h:outputLabel>
                                    </td>

                                </tr>

                                <tr>
                                    <td>
                                        <b>
                                            <h:outputLabel value="Total Fee" ></h:outputLabel>
                                        </b>
                                    </td>
                                    <td>
                                        <p:spacer width="10" ></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <b>
                                            <h:outputLabel value="#{cc.attrs.bill.netTotal+cc.attrs.bill.vat}" >
                                                <f:convertNumber pattern="#,##0.00" ></f:convertNumber>
                                            </h:outputLabel>
                                        </b>
                                    </td>

                                </tr>

                                <tr>
                                    <td>
                                        <h:outputLabel value="Debiter Code" rendered="#{cc.attrs.bill.creditCompany ne null or cc.attrs.bill.toStaff ne null}"></h:outputLabel>
                                    </td>
                                    <td>
                                        <p:spacer width="10" rendered="#{cc.attrs.bill.creditCompany ne null or cc.attrs.bill.toStaff ne null}"></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" rendered="#{cc.attrs.bill.creditCompany ne null or cc.attrs.bill.toStaff ne null}"></h:outputLabel>
                                    </td>
                                    <td>
                                        <h:outputLabel value="#{cc.attrs.bill.creditCompany.institutionCode}" rendered="#{cc.attrs.bill.creditCompany ne null}"/>
                                        <h:outputLabel value="(#{cc.attrs.bill.toStaff.code})" rendered="#{cc.attrs.bill.toStaff ne null}"/>
                                    </td>
                                </tr>

                                <tr>
                                    <td>
                                        <h:outputLabel value="Billed At" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <p:spacer width="10" ></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <h:outputLabel value="#{cc.attrs.bill.createdAt}">
                                            <f:convertDateTime pattern="dd MM yy hh:mm a" ></f:convertDateTime>
                                        </h:outputLabel>
                                    </td>
                                </tr>

                                <tr>
                                    <td>
                                        <h:outputLabel value="Cashier Name" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <p:spacer width="10" ></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" ></h:outputLabel>
                                    </td>
                                    <td>
                                        <h:outputLabel value="#{cc.attrs.bill.creater.webUserPerson.name}" rendered="#{cc.attrs.bill.paidBill eq null}" ></h:outputLabel>
                                        <h:outputLabel value="#{cc.attrs.bill.paidBill.creater.code}" rendered="#{cc.attrs.bill.paidBill ne null}" ></h:outputLabel>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <h:outputLabel value="Printed By" rendered="#{cc.attrs.bill.creater ne sessionController.loggedUser}"></h:outputLabel>
                                    </td>
                                    <td>
                                        <p:spacer width="10" rendered="#{cc.attrs.bill.creater ne sessionController.loggedUser}"></p:spacer>
                                    </td>
                                    <td>
                                        <h:outputLabel value=":" rendered="#{cc.attrs.bill.creater ne sessionController.loggedUser}"></h:outputLabel>
                                    </td>
                                    <td>
                                        <h:outputLabel value="#{sessionController.loggedUser.code}" rendered="#{cc.attrs.bill.creater ne sessionController.loggedUser}"></h:outputLabel>
                                    </td>
                                </tr>
<!--                                <tr>
                                    <td colspan="4">
                                        <P>
                                            <sup>*</sup>Note : Above bill inclusive of Hospital Charges, Professional fee &amp; Government Taxes.  
                                        </P>
                                    </td>
                                </tr>-->

                            </table>
                        </div>
                    </div>
                </h:panelGroup>
            </div>








        </h:panelGroup>
    </cc:implementation>
</html>